<html>
	<head>
		
		<style type="text/css">

			#windowArea1{width:1000px;height:600px;border:1px solid black;overflow:hidden;position:absolute;left:100px;top:30px;}

			.window{width:100px;height:100px;background:gray;padding:10px;}
			.window .head{height:20%;background:red;}
			.window .body{height:80%;background:blue;}

		</style>

	</head>
	<body>
		<div id="windowArea1">
			<div class="window">
				<div class="head"></div>
				<div class="body"></div>
			</div>
		</div>
		
		<div id="txt"></div>
		<div id="txt1"></div>
	</body>
	<script type="text/javascript">
	
		//maybe should use pure javascript for performance.
		
		var mainHTML=
					'<div class="window">'+
						'<div class="head"></div>'+
						'<div class="body"></div>'+
						'<button>asdf</button>'+
					'</div>';

		function WindowArea(dWinArea,dragClassName){
//			var self=this;
			this.dragClassName=dragClassName;
			this.dWinArea=dWinArea;
			
			dWinArea.addEventListener("mousedown",this.winMousedown.bind(this),false);
			dWinArea.addEventListener("mouseup",this.winMouseup.bind(this),false);
//			dWinArea.onmouseup=function(e){alert(e.keyCode);};
//			dWinArea.onmousemove=function(e){alert(e.keyCode);};
		}
		
		WindowArea.prototype={
			
			winMousedown:function(e){
			
				if(e.target.className==this.dragClassName){
					document.getElementById("txt1").innerHTML+="m down<br/>";
				
				var originWindow=this.$container.offset();
				this.originDiff={					
					left:originWindow.left-e.pageX,
					top:originWindow.top-e.pageY
				};
					this.xxx=this.winMousemove.bind(this);
					this.dWinArea.addEventListener("mousemove",this.xxx,false);
				}
			},
			
			
			winMousemove:function(e){
				
				document.getElementById("txt").innerHTML=e.clientX +" "+e.clientY;
			
			},
			
			winMouseup:function(e){
			document.getElementById("txt1").innerHTML+="m up<br/>";
				this.dWinArea.removeEventListener("mousemove",this.xxx,false);
			}
			
			
						

		}
		

			
			var window1=new WindowArea(document.getElementById("windowArea1"),"head");

var a=true;
var b=new Boolean(true)
alert(typeof a);alert(typeof b);
		</script>
</html>